; eax is modified
CPUID_EDX_LM      = 20000000h
CPUID_EDX_PAE     = 00000040h
CPUID_ECX_VMX     = 00000020h

macro IsCpuSupportCPUID {
  push ecx edx
  pushfd

  pushfd
  pop ecx
  mov edx,ecx
  xor ecx,EFL_ID
  push ecx
  popfd
  pushfd
  pop ecx
  xor eax,eax
  cmp ecx,edx  
  jz @f
  add eax,1
@@:
  popfd
  pop edx ecx
}

macro IsCpuSupportLmode {
  push ebx ecx edx 
  mov eax,80000001h
  cpuid
  xor eax,eax
  test edx,CPUID_EDX_LM
  jz @f
  add eax,1
@@:
  pop edx ecx ebx
}

macro IsCpuSupportPAE {
  push ebx ecx edx 
  mov eax,01h
  cpuid
  xor eax,eax
  test edx,CPUID_EDX_PAE
  jz @f
  add eax,1
@@:
  pop edx ecx ebx
}

macro IsCpuSupportVMX {
  push ebx ecx edx 
  mov eax,01h
  cpuid
  xor eax,eax
  test ecx,CPUID_ECX_VMX
  jz @f
  add eax,1
@@:
  pop edx ecx ebx
}

